---
sidebar_label: Async Action logs clean up
sidebar_position: 11
description: Clean up async action logs
keywords:
  - hasura
  - docs
  - actions
  - clean up
  - async actions
---

# Clean up Async Action Logs

## Introduction

Hasura stores action logs of [async Actions](/actions/async-actions.mdx) in a table in **the "hdb_catalog" schema of the
Hasura Metadata database**.

As the table gets larger, you may want to prune it. You can use any of the following options to prune your logs
depending on your need.

:::caution Warning

- Deleting logs is irreversible, so be careful with these Actions.
- Deleting logs while subscriptions for the response might still be open may result into the loss of data and `null`
  values been returned.

The steps described below are only accessible for self-hosted EE customers. For Cloud customers,
[please reach out to support](https://support.hasura.io/hc/en-us/requests/new) for help in cleaning up async Action
logs.

:::

## The table involved

There is a specific table for action logs that is managed by Hasura:

- `hdb_catalog.hdb_action_log`: This table stores all captured action logs.

## Option 1: Delete log of a particular action invocation

```sql
DELETE FROM hdb_catalog.hdb_action_log WHERE id = '<async-action-id>';
```

## Option 2: Delete all logs of a specific action

```sql
DELETE FROM hdb_catalog.hdb_action_log WHERE action_name = '<action-name>';
```

## Option 3: Delete all logs

```sql
DELETE FROM hdb_catalog.hdb_action_log;
```

## Clearing data before a particular time period

If you wish to keep recent data and only clear data before a particular time period you can add the following time
clause to your query's where clause:

```sql
-- units can be 'minutes', 'hours', 'days', 'months', 'years'
created_at < now() - interval '<x> <units>'
```

For example: to delete all logs older than 3 months:

```sql
DELETE FROM hdb_catalog.hdb_action_log WHERE created_at < NOW() - INTERVAL '3 months';
```

See the [Postgres date/time functions](https://www.postgresql.org/docs/current/functions-datetime.html) for more
details.

:::info Additional Resources

Introduction to Hasura Actions -
[View Recording](https://hasura.io/events/webinar/hasura-actions/?pg=docs&plcmt=body&cta=view-recording&tech=).

:::
